import db from '@/utils/localstorage'
export default {
  namespaced: true,
  state: {
    token: db.get('TOKEN') || '',
    user: db.get('USER') || {},
    roters: db.get('USER_ROUTER') || [],
    pres: db.get('PRES') || []
  },
  mutations: {
    setToken(state, val) {
      state.token = val
      db.save('TOKEN', val)
    },
    setUser(state, val) {
      state.user = val
      db.save('USER', val)
    },
    setRoutes(state, val) {
      state.roters = val
      db.save('USER_ROUTER', val)
    },
    setPres(state, val) {
      state.pres = val
      db.save('PRES', val)
    }
  }
}
